<?php
/**
 * Yii view form
 *
 * @author luubk
 * @since Jan 11, 2013 - 2:46:02 PM
 */
?>
<?php if (Yii::app()->user->hasFlash('contact')): ?>
    <div class="alert alert-error">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>Error!</strong> <?php echo Yii::app()->user->getFlash('contact'); ?>.
    </div>
<?php endif; ?>
<ul class="tab-menu nav nav-tabs tabs-main" id="myTab">
    <!--    <li class="active">
            <a data="#index_tab" class="tab-control">
    <?php // echo Yii::t('post', 'Post'); ?>
    
            </a>
        </li>-->
    <!--    <li>
            <a data="#seo_tab" class="tab-control">
    <?php // echo Yii::t('post', 'SEO') ?>
            </a>
        </li>-->
    <!--    <div class="clear"></div>
    --></ul>
<div id="index_tab" class="project_tab">
    <?php
    $this->beginWidget('MyActiveForm', array(
        'model' => $this->model,
        'title' => $this->pageTitle,
        'columns' => array(
            array(
                'field' => 'title',
                'htmlOptions' => array('class' => "span10"),
            ),
            array(
                'field' => 'url',
                'htmlOptions' => array('readonly' => 'readonly'),
            ),
            array(
                'field' => 'category_id',
                'type' => 'dropDownList',
                'data' => Category::getPublicArray(),
                'htmlOptions' => array('class' => ""),
            ),
            array(
                'field' => 'thumbnail',
                'type' => 'image',
            ),
            array(
                'field' => 'description',
                'type' => 'textarea',
                'htmlOptions' => array('class' => "span10"),
            ),
            array(
                'field' => 'content',
                'type' => 'editor',
            ),
            array(
                'field' => 'status',
                'type' => 'dropDownList',
                'data' => Post::getArrayStatus(),
                'htmlOptions' => array('class' => ""),
            ),
        ),
    ));
    ?>
    <div class="clear"></div>
    <br/>
    <ul id="myTab" class="nav nav-tabs tabs-main">    
        <li class="active">
            <a data-toggle="tab">
                Facebook Form
            </a>
        </li>
    </ul>
    <div class="clearfix"></div>
    <div id="myTabContent" class="tab-content tabs-main-content padding-null">    
        <div class="tab-pane tab-overflow-main fade in active" id="picture">
            <div class="content">
                <input type="checkbox" name="post_fb" style="display: block!important">
                <input type="text" name="fb_msg">
                <input type="text" name="fb_title">
                <textarea name="fb_des"></textarea>
            </div>
        </div>
    </div>
    <div class="clear"></div>
</div>

<?php $this->endWidget(); ?>
<script>
    $(function() {
        $('#Post_title').keyup(function() {
            title = $('#Post_title').val();
            $('#Post_url').val(convertToSlug(title));
        });
        $('#Post_title').keyup(function() {
            title = $('#Post_title').val();
            $('#title_seo').text(title);
        });
        $('#Post_title').keyup(function() {
            title = $('#Post_title').val();
            $('#url_seo').text(convertToSlug(title));
        });
        $('#Post_url').keyup(function() {
            title = $('#Post_url').val();
            $('#url_seo').text(convertToSlug(title));
        });
        $('#Post_url').keyup(function() {
            $('#original_url').hide();
            $('#change_url').show();
        });
        $('#Post_title').keyup(function() {
            $('#change_url').removeClass('hide');
            $('#original_url').hide()();
            $('#change_url').show();
        });
        $('#desc').keyup(function() {
            title = $('#desc').val();
            $('#meta_desc').text(title);
        });
    });
    $('.tab-control').parent().click(function() {
        $('.project_tab').each(function() {
            $(this).addClass('hide');
        });

        id = $(this).children('a').attr('data');
        $(id).removeClass('hide');

        $('.tab-control').each(function() {
            $(this).parent().removeClass('active');
        });

        $(this).addClass('active');
    });
</script>
